//
//  UIBarButtonItem+Extension.swift
//  JLWeibo
//
//  Created by sunjinliang on 15/12/16.
//  Copyright © 2015年 sunjinliang. All rights reserved.
//

import UIKit
extension UIBarButtonItem{
    
    convenience init(imageName: String,target: AnyObject? ,action : String?){
        let button = UIButton(imageName: imageName, backImageName: nil)

        if action != nil{
            
            button.addTarget(target, action: Selector(action!), forControlEvents: UIControlEvents.TouchUpInside)
        }
        button.sizeToFit()
        self.init(customView: button)
    }
}